
/* Define to prevent recursive inclusion -------------------------------------*/
#pragma once

/* Includes ------------------------------------------------------------------*/
#include "app_utils.h"
/* Exported types ------------------------------------------------------------*/


/* Exported constants --------------------------------------------------------*/
#define WRITE            0x02     /* write to memory instruction */
#define QUADWRITE        0x32     /* quad write to memory instruction */
#define WRSR             0x01     /* write status register instruction */
#define WREN             0x06     /* write enable instruction */

#define READ             0x03     /* read from memory instruction */
#define QUADREAD         0x6B     /* read from memory instruction */
#define RDSR             0x05     /* read status register instruction */
#define RDID             0x9F     /* read identification */
#define SE               0x20     /* sector erase instruction */
#define BE               0xC7     /* bulk erase instruction */

#define WTSR             0x05     /* write status register instruction */

#define WIP_FLAG         0x01     /* write in progress(wip) flag */
#define DUMMY_BYTE       0xA5

#define SPI_FLASH_PAGE_SIZE         0x100
#define SPI_FLASH_SECTOR_SIZE       0x1000
 
#define SPI_FLASH_SECTOR_COUNT      0x1000
#define SPI_FLASH_BLOCK_SIZE	    0x10000
#define FLASH_PAGES_PER_SECTOR	  (SPI_FLASH_SECTOR_SIZE/SPI_FLASH_PAGE_SIZE)
/* Exported macros -----------------------------------------------------------*/


/* Exported functions --------------------------------------------------------*/



/* Initialization and de-initialization functions *****************************/


/* Callbacks Register/UnRegister functions  ***********************************/

/* Configuration functions ****************************************************/
	

/* Control functions **********************************************************/
uint32_t u32STORAGE_GetID(void);
void vSTORAGE_EraseAll(void);
void vSTORAGE_EraseSec(uint32_t sector_addr);
void vSTORAGE_PageWrite(uint8_t* pbuffer, uint32_t write_addr, uint16_t num_byte_to_write);
void vSTORAGE_BufferWrite(uint8_t* pbuffer, uint32_t write_addr, uint16_t num_byte_to_write);
void vSTORAGE_BufferRead(uint8_t* pbuffer, uint32_t read_addr, uint16_t num_byte_to_read);
bool bSTORAGE_ItsBlankSector(uint32_t read_addr);





